import {
  createRouter,
  createWebHashHistory,
  createWebHistory,
} from "vue-router";
import HomeVue from "../views/Home.vue";
const routes = [
  {
    path: "/",
    component: HomeVue,
  },
  {
    // path: "/index/:id",
    path: "/index",
    name: "Index",
    component: () => import("../views/Index.vue"),
  },
  {
    path: "/s",
    name: "s",
    component: () => import("../views/Store.vue"),
  },
  {
    path: "/p",
    name: "p",
    component: () => import("../views/Pinia.vue"),
  },
];

const router = createRouter({
  routes,
  history: createWebHashHistory(),
});

export default router;

/**
 *  使用路由的过程
 *      1. 下载安装
 *      2. 声明一个 路由 对象
 *          createRouter
 *          需要指定 路由模式 history: createWebHashHistory()
 *      3. 进行路由表的配置
 *          path , compoent , name ,meta , children , ...
 *      4. 在main.js 注册路由
 *          app.use(路由对象)
 *      5. 在App.vue 里面添加 router-view
 */
